package com.imooc.bilibili.service;

import com.imooc.bilibili.entity.VideoCoinsInfo;
import com.imooc.bilibili.entity.VideoCollectionInfo;
import com.imooc.bilibili.entity.VideoInfo;
import com.imooc.bilibili.entity.VideoView;
import com.imooc.bilibili.entity.page.PageResult;
import org.apache.mahout.cf.taste.common.TasteException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;

public interface VideoService {
    /**
     * 视频投稿
     * @param videoInfo
     */
    void insertVideoService(VideoInfo videoInfo);

    /**
     * 分页查询
     * @param size
     * @param no
     * @param area
     * @return
     */
    PageResult<VideoInfo> pageListVideos(Integer size, Integer no, String area);

    /**
     * 在线播放
     * @param request
     * @param response
     * @param url
     * @throws Exception
     */
    void viewVedioOnlineSilicesService(HttpServletRequest request, HttpServletResponse response, String url) throws Exception;

    /**
     * 点赞
     * @param videoId
     * @param userId
     */
    void insertVideoLikeService(Long videoId, Long userId);

    /**
     * 取消点赞
     * @param videoId
     * @param userId
     */
    void delteVideoLikeService(Long videoId, Long userId);

    /**
     * 统计点赞数量
     * @param videoId
     * @param userId
     * @return
     */
    Map<String, Object> getVideoLikeNumService(Long videoId, Long userId);

    /**
     * 添加收藏信息
     * @param collectionInfo
     */
    void insertVideoCollectionService(VideoCollectionInfo collectionInfo);

    /**
     * 取消收藏
     * @param userId
     * @param videoId
     */
    void deleteVideoColletionService(Long userId, Long videoId);

    /**
     * 统计视频收藏数量
     * @param videoId
     * @return
     */
    Map<String, Object> getVideoCollectionNumService(Long videoId,Long userId);

    /**
     * 视频投币
     * @param videoCoinsInfo
     */
    void insertVideoCoinsService(VideoCoinsInfo videoCoinsInfo);

    /**
     * 查询视频投币数
     * @param userId
     * @param videoId
     * @return
     */
    Map<String, Object> queryVideoCoinsCountService(Long userId, Long videoId);

    /**
     * 查询视频详情
     * @param videoId
     * @return
     */
    Map<String, Object> getVideoDetailsService(Long videoId);


    /**
     * 添加视频的观看记录
     * @param view
     * @param request
     */
    void insertVideoViewService(VideoView view, HttpServletRequest request);

    /**
     * 查询视频的关键记录数
     * @param videoId
     * @return
     */
    Integer queryVideoViewCountsServicec(Long videoId);

    /**
     * 视频推荐功能实现
     * @param userId
     * @return
     */
    List<VideoInfo> recommendService(Long userId) throws TasteException;
}
